/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * @file           : main.h
  * @brief          : Header for main.c file.
  *                   This file contains the common defines of the application.
  ******************************************************************************
  * @attention
  *
  * Copyright (c) 2024 STMicroelectronics.
  * All rights reserved.
  *
  * This software is licensed under terms that can be found in the LICENSE file
  * in the root directory of this software component.
  * If no LICENSE file comes with this software, it is provided AS-IS.
  *
  ******************************************************************************
  */
/* USER CODE END Header */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_hal.h"

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include <stdarg.h>
#include "stdio.h"
#include "string.h"
#include "stdlib.h"


/* USER CODE END Includes */

/* Exported types ------------------------------------------------------------*/
/* USER CODE BEGIN ET */

/* USER CODE END ET */

/* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN EC */
typedef struct{
    uint16_t reclen;
    uint8_t data[1024];
    uint8_t recflag;
    uint8_t id;
    uint8_t cmd;
}RecData;
/* USER CODE END EC */

/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */
#define PWM_Period  3500
/* USER CODE END EM */

/* Exported functions prototypes ---------------------------------------------*/
void Error_Handler(void);

/* USER CODE BEGIN EFP */

/* USER CODE END EFP */

/* Private defines -----------------------------------------------------------*/
#define Motor0_CS_Pin GPIO_PIN_0
#define Motor0_CS_GPIO_Port GPIOA
#define MOTOR_AL_Pin GPIO_PIN_13
#define MOTOR_AL_GPIO_Port GPIOB
#define MOTOR_BL_Pin GPIO_PIN_14
#define MOTOR_BL_GPIO_Port GPIOB
#define MOTOR_CL_Pin GPIO_PIN_15
#define MOTOR_CL_GPIO_Port GPIOB
#define MOTOR_AH_Pin GPIO_PIN_8
#define MOTOR_AH_GPIO_Port GPIOA
#define MOTOR_BH_Pin GPIO_PIN_9
#define MOTOR_BH_GPIO_Port GPIOA
#define MOTOR_CH_Pin GPIO_PIN_10
#define MOTOR_CH_GPIO_Port GPIOA
#define TEST_Pin GPIO_PIN_2
#define TEST_GPIO_Port GPIOD

/* USER CODE BEGIN Private defines */
#define M0_CS(a)  a?HAL_GPIO_WritePin(Motor0_CS_GPIO_Port,Motor0_CS_Pin,GPIO_PIN_SET):HAL_GPIO_WritePin(Motor0_CS_GPIO_Port,Motor0_CS_Pin,GPIO_PIN_RESET)
extern RecData USBRecData;
extern RecData CanRecData;
extern void usb_printf(const char *format, ...);
extern uint8_t Test(void);
extern void CanTest(void);
/* USER CODE END Private defines */

#ifdef __cplusplus
}
#endif

#endif /* __MAIN_H */
